package com.qf.hospital.mapper;

import com.qf.hospital.entity.Report;
import com.qf.hospital.entity.ReportExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ReportMapper {
    long countByExample(ReportExample example);

    int deleteByExample(ReportExample example);

    int deleteByPrimaryKey(Integer reportId);

    int insert(Report record);

    int insertSelective(Report record);

    List<Report> selectByExample(ReportExample example);

    Report selectByPrimaryKey(Integer reportId);

    int updateByExampleSelective(@Param("record") Report record, @Param("example") ReportExample example);

    int updateByExample(@Param("record") Report record, @Param("example") ReportExample example);

    int updateByPrimaryKeySelective(Report record);

    int updateByPrimaryKey(Report record);

    @Select("SELECT COUNT(0) FROM `report` WHERE DATE_FORMAT(time,'%Y-%m-%d')=DATE_FORMAT(CURTIME(),'%Y-%m-%d') AND state!=0")
    long findReportByCurrent();

    /**
     * 根据患者信息查询挂号信息
     * @param cc
     * @param name
     * @return
     */
    List<Report> findPatientInfo(@Param("cc") Integer cc, @Param("name") String name);

    /**
     * 查询该字段的值为该参数的个数
     * @param name
     * @param value
     * @return
     */
    Integer countByValue(@Param("name") String name, @Param("value") String value);

    /**
     * 查询当天患者信息
     * @param name
     * @return
     */
    List<Report> findTheDayPerson(@Param("name") String name);
}